﻿using System.Windows.Automation;

namespace QuickUIT.Controls
{
    /// <summary>
    /// Represnets a spinner control. 
    /// </summary>
    public class UISpinner : UIBaseControl
    {
        /// <summary>
        /// Specifices the current range value for the spinner control. 
        /// </summary>
        public new double RangeValue
        {
            get { return base.RangeValue; }
            set { SetRangeValue(value); }
        }

        /// <summary>
        /// Gets whether the spinner control is read-only. 
        /// </summary>
        public new bool IsRangeReadOnly
        {
            get { return base.IsRangeReadOnly; }
        }

        /// <summary>
        /// Gets the maximum value for the spinner control. 
        /// </summary>
        public new double Maximum
        {
            get { return base.Maximum; }
        }

        /// <summary>
        /// Gets the minimum value for the spinner control.
        /// </summary>
        public new double Minimum
        {
            get { return base.Minimum; }
        }

        /// <summary>
        /// Gets the large change value for the spinner control. 
        /// </summary>
        public new double LargeChange
        {
            get { return base.LargeChange; }
        }

        /// <summary>
        /// Gets the small change value for the spinner control. 
        /// </summary>
        public new double SmallChange
        {
            get { return base.SmallChange; }
        }

        /// <summary>
        /// Spinner controls are always single selection containers. 
        /// </summary>
        public new bool CanSelectMultiple
        {
            get { return base.CanSelectMultiple; }
        }

        /// <summary>
        /// Gets whether the spinner control requires at least one child element to be selected. 
        /// </summary>
        public new bool IsSelectionRequired
        {
            get { return base.IsSelectionRequired; }
        }

        /// <summary>
        /// Gets the value of the spinner control.
        /// </summary>
        public new string Value
        {
            get { return base.Value; }
            set { SetValue(value); }
        }

        /// <summary>
        /// Gets a value which indicates whether the spinner control is read-only. 
        /// </summary>
        public new bool IsReadOnly
        {
            get { return base.IsReadOnly; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UISpinner"/> class. 
        /// </summary>
        public UISpinner()
            : base(ControlType.Spinner)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UISpinner"/> class.
        /// </summary>
        /// <param name="parent">The parent of this control.</param>
        public UISpinner(UIBaseControl parent)
            : base(parent, ControlType.Spinner)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UISpinner"/> class.
        /// </summary>
        /// <param name="locator">The locator used to find the specific control.</param>
        public UISpinner(string locator)
            : base(null, ControlType.Spinner, locator)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UISpinner"/> class.
        /// </summary>
        /// <param name="parent">The parent of this control.</param>
        /// <param name="locator">The locator used to find the specific control.</param>
        public UISpinner(UIBaseControl parent, string locator)
            : base(parent, ControlType.Spinner, locator)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UISpinner"/> class.
        /// </summary>
        /// <param name="control">The underlying <see cref="AutomationElement"/> of the control.</param>
        public UISpinner(AutomationElement control) : base(control, ControlType.Spinner)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UISpinner"/> class.
        /// </summary>
        /// <param name="parent">The parent of the control</param>
        /// <param name="control">The underlying <see cref="AutomationElement"/> of the control.</param>
        public UISpinner(UIBaseControl parent, AutomationElement control) : base(parent, control, ControlType.Spinner)
        {
        }

        /// <summary>
        /// Gets a collection of automation elements that represents the current selection for an element.
        /// </summary>
        /// <returns>A collection of selected elements.</returns>
        public new AutomationElement[] GetSelection()
        {
            return base.GetSelection(); 
        }

        /// <summary>
        /// Sets the value of the spinner control. 
        /// </summary>
        /// <param name="value">The value to set.</param>
        public new void SetValue(string value)
        {
            base.SetValue(value);
        }

        /// <summary>
        /// Sets the range value of the spinner control.
        /// </summary>
        /// <param name="value">The value to set.</param>
        public new void SetRangeValue(double value)
        {
            base.SetRangeValue(value);
        }
    }
}
